this.BX=this.BX||{};(function(t,i,e,o,a){"use strict";var s,n,l;var u=function(){function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);this.title=e.title||null;this.content=e.content||null;this.bottomText=e.bottomText||i.Loc.getMessage("UI_QR_AUTHORIZE_TAKE_CODE");this.helpLink=e.helpLink||null;this.qr=e.qr||null;this.popupParam=e.popupParam||null;this.popup=null;this.loader=null;this.qrNode=null;this.successNode=null;this.loadingNode=null;this.isSubscribe=false}babelHelpers.createClass(t,[{key:"createQrCodeImage",value:function t(){var e=this;i.Dom.clean(this.getQrNode());if(i.Type.isString(this.qr)){this.clean();new QRCode(this.getQrNode(),{text:this.qr,width:180,height:180});return}this.loading();i.ajax.runAction("mobile.deeplink.get",{data:{intent:"calendar"}}).then((function(t){var i;var o=(i=t.data)===null||i===void 0?void 0:i.link;if(o){e.clean();new QRCode(e.getQrNode(),{text:o,width:180,height:180});if(!e.isSubscribe){e.isSubscribe=true;e.subscribe()}}}))["catch"]((function(){}))}},{key:"subscribe",value:function t(){var i=this;if(a.PULL){a.PULL.subscribe({type:"BX.PullClient.SubscriptionType.Server",moduleId:"mobile",command:"onDeeplinkShouldRefresh",callback:function t(e){i.success()}})}}},{key:"getQrNode",value:function t(){if(!this.qrNode){this.qrNode=i.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-qr-authorization__popup-qr"></div>\n\t\t\t'])))}return this.qrNode}},{key:"getPopup",value:function t(){var o=this;if(!this.popup){var a,s,n,l,u,r,d,h,c,p,v,g,m,f;var b=i.Type.isObject(this.title)?(a=this.title)===null||a===void 0?void 0:a.text:this.title;var _=i.Type.isObject(this.title)?(s=this.title)===null||s===void 0?void 0:s.size:"";var N=i.Type.isObject(this.bottomText)?(n=this.bottomText)===null||n===void 0?void 0:n.text:this.bottomText;var q=i.Type.isObject(this.bottomText)?(l=this.bottomText)===null||l===void 0?void 0:l.size:"";var L='\n\t\t\t\t<div class="ui-qr-authorization__popup-wrapper">\n\t\t\t\t\t<div class="ui-qr-authorization__popup-top '.concat(!this.content?"--direction-column":"",'">\n\t\t\t\t\t\t<div class="ui-qr-authorization__popup-left ').concat(!b?"--flex":"",'"">\n\t\t\t\t\t\t\t').concat(b?'<div class="ui-qr-authorization__popup-title --'.concat(_,'">').concat(b,"</div>"):"","\n\t\t\t\t\t\t\t").concat(this.content?'<div class="ui-qr-authorization__popup-text">'.concat(this.content,"</div>"):"",'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="ui-qr-authorization__popup-right ').concat(!this.title?"--no-margin":"",'" data-role="ui-qr-authorization__qr-node"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="ui-qr-authorization__popup-bottom">\n\t\t\t\t\t\t<div class="ui-qr-authorization__popup-bottom--title ').concat(q?"--"+q:"",'">').concat(N,"</div>\n\t\t\t\t\t\t").concat(this.helpLink?'<a href="'.concat(this.helpLink,'" class="ui-qr-authorization__popup-bottom--link">').concat(i.Loc.getMessage("UI_QR_AUTHORIZE_HELP"),"</a>"):"","\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t");var y=this.content?710:405;var k={className:(u=this.popupParam)!==null&&u!==void 0&&u.className?(r=this.popupParam)===null||r===void 0?void 0:r.className:"ui-qr-authorization__popup ui-qr-authorization__popup-scope",width:(d=this.popupParam)!==null&&d!==void 0&&d.width?(h=this.popupParam)===null||h===void 0?void 0:h.width:y,content:L,closeByEsc:(c=this.popupParam)!==null&&c!==void 0&&c.closeByEsc?(p=this.popupParam)===null||p===void 0?void 0:p.className:true,overlay:(v=this.popupParam)!==null&&v!==void 0&&v.overlay?(g=this.popupParam)===null||g===void 0?void 0:g.overlay:false,autoHide:(m=this.popupParam)!==null&&m!==void 0&&m.autoHide?(f=this.popupParam)===null||f===void 0?void 0:f.autoHide:true,closeIcon:{top:"14px",right:"15px"},events:{onPopupShow:function t(){o.createQrCodeImage();var i=o.getPopup().getContentContainer().querySelector('[data-role="ui-qr-authorization__qr-node"]');if(i){i.appendChild(o.getQrNode())}}},padding:0,animation:"fading-slide"};this.popup=new e.Popup(k)}return this.popup}},{key:"success",value:function t(){this.clean();this.getQrNode().classList.add("--success");this.getQrNode().appendChild(this.getSuccessNode())}},{key:"getSuccessNode",value:function t(){if(!this.successNode){this.successNode=i.Tag.render(n||(n=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-qr-authorization__popup-qr-success"></div>\n\t\t\t'])))}return this.successNode}},{key:"loading",value:function t(){this.clean();this.getQrNode().classList.add("--loading");this.getQrNode().appendChild(this.getLoadingNode());this.showLoader()}},{key:"getLoadingNode",value:function t(){if(!this.loadingNode){this.loadingNode=i.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-qr-authorization__popup-qr-loading"></div>\n\t\t\t'])))}return this.loadingNode}},{key:"getLoader",value:function t(){if(!this.loader){this.loader=new o.Loader({target:this.getLoadingNode(),size:150})}return this.loader}},{key:"showLoader",value:function t(){void this.getLoader().show()}},{key:"hideLoader",value:function t(){void this.getLoader().hide()}},{key:"clean",value:function t(){this.getQrNode().classList.remove("--loading");this.getQrNode().classList.remove("--success");i.Dom.remove(this.getLoadingNode());i.Dom.remove(this.getSuccessNode());this.hideLoader()}},{key:"show",value:function t(){if(!this.getPopup().isShown()){this.loading();this.getPopup().show()}}},{key:"close",value:function t(){if(this.getPopup().isShown()){this.clean();this.getPopup().close()}}}]);return t}();t.QrAuthorization=u})(this.BX.UI=this.BX.UI||{},BX,BX.Main,BX,BX);
//# sourceMappingURL=bundle.map.js